﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Common;
using CNCSoft.EData;

namespace CNCSoft.ErpApps.TMS.longGiaoVu
{
    public partial class frmDanhSachKhoaHoc : Form
    {
        DataSet ds = new DataSet();

        public frmDanhSachKhoaHoc()
        {
            InitializeComponent();
        }

        private void frmDanhSachKhoaHoc_Load(object sender, EventArgs e)
        {
            LoadControl();
        }

        #region "Coding"
        private void LoadControl()
        {
            try
            {
                LoadData();
                gridControl_Data.DataSource = ds.Tables["TableKhoaHoc"];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        DataTable dt;
        private void LoadData()
        {
            try
            {
                if (ds.Tables["TableKhoaHoc"] == null)
                    dt = ds.Tables.Add("TableKhoaHoc");
                else
                    dt.Clear();
                string sql = @"usp_AllKhoaHocByDonVi @madonvi = '" + GlobalVariable.WSInfo.CompanyID + "'";
                SQLHelper.Fill(dt, GlobalVariable.WSInfo.ConnectionString, sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion
    }
}
